﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ETL.Common;
using ETL.Common.Logging;
using ETL.DataAccess;
using ETL.Entity;

namespace ETL.Business.Handlers.ProjectTaskHandler
{
    public class UpdateProjectTaskStartDate
    {

        private readonly ProjectTaskRepository _projectTaskRepository;

        public UpdateProjectTaskStartDate(ProjectTaskRepository projectTaskRepository)
        {
            _projectTaskRepository = projectTaskRepository;
        }
        //public UpdateProjectTaskStartDate()
        //{
        //    _projectTaskRepository = new ProjectTaskRepository();
        //}

        /**
        public virtual void Execute(string projectId, string categoryId, string taskId, DateTime newStartDate)
        {
            TASK projectTaskData = null;

            // try to get from db
            try
            {
                // convert
                projectTaskData = 
                    _projectTaskRepository.GetProjectTask(int.Parse(projectId), int.Parse(categoryId), int.Parse(taskId));
            }
            catch (Exception ex)
            {
                LogService.Service.Debug(ex);
            }

            // Update project start date, status
            if (projectTaskData != null && !projectTaskData.t_start_date.HasValue)
            {
                projectTaskData.t_start_date = newStartDate;
                projectTaskData.t_status = Constants.ProjectStatusCode.IN_PROGRESS;

                _projectTaskRepository.Update(projectTaskData);
            }

        } **/

    }
}
